<section class="content-header">
  <!-- <h1>
        年检业务
    </h1> -->
  <ol class="breadcrumb">
    <li><a ui-sref="dashboard"><i class="fa fa-dashboard"></i>我的面板</a></li>
    <li><a ui-sref="annual">年检列表</a></li>
    <li class="active">详情</li>
  </ol>
</section>
<section class="content">
  <form class="form-horizontal view-form" id="annual_form">
    <div class="detail-view-header-wrapper">
      <div class="box-footer detail-view-header" ui-scrollpoint ui-scrollpoint-enabled="true" ui-scrollpoint-class="fixed">
        <button type="button" class="btn btn-info" ui-sref="annual_edit({id: id})" ng-if="data.status == 0 || data.review_status == 0" ui-sref-opts="{reload:true}">修改</button>
        <button type="button" class="btn btn-primary" ng-click="submitAudit()" ng-if="data.status == 0 || data.review_status == 0">提交审核</button>
        <button type="button" class="btn btn-primary" ng-click="reAudit()" ng-if="data.status >= 1 && userInfo.username=='admin'">反审核</button>
        <button type="button" class="btn btn-success" ng-click="passAuditF()" ng-if="data.status==1 && opers.indexOf(3) > -1">财务审核通过</button>
        <button type="button" class="btn btn-danger" ng-click="refuseAudit()" ng-if="data.status==1 && opers.indexOf(3) > -1">财务审核驳回</button>
        <button type="button" class="btn btn-success" ng-click="passAudit()" ng-if="data.status > 1 && data.status < 3 && opers.indexOf(4) > -1">提交审核通过</button>
        <button type="button" class="btn btn-danger" ng-click="refuseAudit()" ng-if="data.status > 1 && data.status < 3 && opers.indexOf(4) > -1">提交审核驳回</button>
        <button type="button" class="btn btn-success" ng-click="progress('p')" ng-if="data.status >= 3">进度反馈</button>
        <button type="button" class="btn btn-info" ui-sref="annual_timeline({id: data.id, name: 'annual', code: data.code, source: 'view'})"><span class="fa fa-clock-o"></span>日志</button>
        <a href="/print.html?m=annual&id={{id}}" class="btn btn-info" target="_blank">打印</a>
        <span>状态: </span>
        <span class="tooltip-author" ng-if="data.status != 4" ng-bind="getOrderStatus() + ' | ' + getReviewStatus()" ng-attr-title="{{getTitle(data)}}" style="cursor: default;"></span>
        <span ng-if="data.status == 4" ng-bind="'已完成 | ' + format(data.date_finish, 'YYYY-MM-DD')"></span>
      </div>
    </div>
    <div class="box box-danger">
      <div class="box-header with-border">
        <h3 class="box-title">年检信息</h3>
        <div class="box-tools">
          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
            </button>
          </div>
        </div>
      </div>
      <div class="box-body">
        <div class="form-group">
          <label class="col-sm-2 control-label">单号</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.code"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">客户档案号</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.customer_code"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">客户名称</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.customer_name"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">年检类别</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="getTypeName(data.type)"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">年检年份</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.start_annual"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">订单单号</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.order_code"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">订单名称</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.name_cn"></span>
          </div>
        </div>
        <div class="form-group" ng-if="data.name_en.length > 0">
          <label class="col-sm-2 control-label">英文名</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.name_en"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">成交日期</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="format(data.date_transaction, 'YYYY-MM-DD')"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">成交金额</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.amount_transaction"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">交易币别</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.currency"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">汇率</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.rate"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">其他事项</label>
          <div class="col-sm-8">
            <textarea class="form-control" rows="3" name="description" ng-model="data.description" readonly style="background:#fff;"></textarea>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">年检进度</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="!!data.progress? (' ' + data.progress) : ' 无进度信息'"></span>
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">年检客服</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.waiter_name"></span>
          </div>
        </div>

        <div class="form-group">
          <label class="col-sm-2 control-label">客户归属</label>
          <div class="col-sm-8" ng-bind="data.salesman" style="line-height: 30px;">
          </div>
        </div>
        <div class="form-group">
          <label class="col-sm-2 control-label">订单归属</label>
          <div class="col-sm-8" ng-bind="data.order_owner" style="line-height: 30px;">
          </div>
        </div>

        <div class="form-group">
          <label class="col-sm-2 control-label">供应商</label>
          <div class="col-sm-8" ng-bind="data.supplier_name" style="line-height: 30px;">
          </div>
        </div>

        <!-- <div class="form-group">
          <label class="col-sm-2 control-label">客户归属</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.salesman"></span>
          </div>
        </div> -->
        <!-- <div class="form-group">
          <label class="col-sm-2 control-label">助理</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.assistant_name"></span>
          </div>
        </div> -->
        <!-- <div class="form-group">
          <label class="col-sm-2 control-label">会计</label>
          <div class="col-sm-8">
            <span class="form-span" ng-bind="data.accountant_name"></span>
          </div>
        </div> -->
      </div>
    </div>
    <div class="box box-danger">
      <div class="box-header with-border">
        <h3 class="box-title">收款记录</h3>
        <div class="box-tools pull-right">
          <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
          </button>
        </div>
      </div>
      <div class="box-body table-responsive no-padding">
        <table class="table table-hover">
          <tbody>
            <tr>
              <th style="width: 10px">#</th>
              <th>付款人</th>
              <th>收款银行</th>
              <th>收款账号</th>
              <th>收款金额</th>
              <th>币别</th>
              <th>汇率</th>
              <th>收款方式</th>
              <th>收款时间</th>
              <th>附件</th>
              <th>备注</th>
              <th class="opt-col">操作</th>
            </tr>
            <tr ng-repeat="item in incomes.items">
              <td ng-bind="($index+1)+'.'"></td>
              <td ng-bind="item.payer"></td>
              <td ng-bind="item.bank"></td>
              <td ng-bind="item.account"></td>
              <td ng-bind="item.amount"></td>
              <td ng-bind="item.currency"></td>
              <td ng-bind="item.rate"></td>
              <td ng-bind="item.pay_way"></td>
              <td ng-bind="format(item.date_pay, 'YYYY-MM-DD')"></td>
              <td>
                <a href="{{item.attachment_url}}" target="_blank" ng-if="item.attachment_url.length">
                  <img ng-src="{{item.attachment_url}}" width="22" height="22">
                </a>
              </td>
              <td ng-bind="item.description"></td>
              <td class="opt-col">
                <a  ng-if="data.status == 0" class="fa fa-pencil orange" ui-sref=".income_edit({tid: {{item.id}}})" ui-sref-opts="{location:false}" title="修改"></a>
                <a  ng-if="data.status == 0" href="javascript:;" class="fa fa-trash-o red" ng-click="deleteIncome(item)" title="删除"></a>
                <a  href="/print.html?m=annual_line&id={{item.id}}" target="_blank">打印</a>
              </td>
            </tr>
            <tr>
              <td></td>
              <td class="summary" colspan="2">
                <div>
                  <span>本币: </span>
                  <span class="num">人民币</span>
                </div>
                <div>
                  <span>应收款: </span>
                  <span class="num receivable" ng-bind="incomes.amount"></span>
                </div>
                <div>
                  <span>已收款: </span>
                  <span class="num received" ng-bind="incomes.total"></span>
                </div>
                <div>
                  <span>未收款: </span>
                  <span class="num balance" ng-bind="incomes.balance"></span>
                </div>
              </td>
              <td class="summary" colspan="2">
              </td>
              <td class="summary" colspan="7">
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="box-footer clearfix">
        <button type="button" class="btn btn-info" ui-sref=".income_add({source_name: 'annual', customer_id: data.customer_id})" ui-sref-opts="{location:false}">新增</button>
        <button type="button" class="btn btn-info" ng-click="printReceipt('new')">新增收据</button>
        <button type="button" class="btn btn-info" ng-click="printReceipt('print')">打印收据</button>
      </div>
    </div>
    <div class="box box-danger" style="padding-bottom: 60px;">
      <div class="box-header with-border">
        <h3 class="box-title">客户信息</h3>
        <div class="box-tools">
          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
            </button>
          </div>
        </div>
      </div>
      <div class="box-body">
        <div class="form-group">
          <a href="javascript:;" class="col-sm-2 control-label" ng-click="showCustomerInfo()" ng-if="customerInfo==null">显示客户信息</a>
        </div>
        <div ng-if="customerInfo != null">
          <div>
            <div class="box-body no-padding">
              <div class="form-group mb-0">
                <label class="col-sm-2 control-label">客户名称:</label>
                <div class="col-sm-8">
                  <span class="form-span" ng-bind="customerInfo.name"></span>
                </div>
              </div>
              <div class="form-group mb-0">
                <label class="col-sm-2 control-label">详细地址:</label>
                <div class="col-sm-8">
                  <span class="form-span" ng-bind="customerInfo.province + customerInfo.city + customerInfo.county + customerInfo.address"></span>
                </div>
              </div>
              <div class="form-group mb-0">
                <label class="col-sm-2 control-label">寄件地址:</label>
                <div class="col-sm-8">
                  <span class="form-span" ng-bind="customerInfo.mailling_province + customerInfo.mailling_city + customerInfo.mailling_county + customerInfo.mailling_address"></span>
                </div>
              </div>
              <div class="form-group mb-0">
                <label class="col-sm-2 control-label">传真:</label>
                <div class="col-sm-8">
                  <span class="form-span" ng-bind="customerInfo.fax"></span>
                </div>
              </div>
              <div class="form-group mb-0">
                <label class="col-sm-2 control-label">业务员:</label>
                <div class="col-sm-8">
                  <span class="form-span" ng-bind="customerInfo.salesman"></span>
                </div>
              </div>
              <div class="form-group mb-0">
                <label class="col-sm-2 control-label">助理:</label>
                <div class="col-sm-8">
                  <span class="form-span" ng-bind="customerInfo.assistant_name"></span>
                </div>
              </div>
            </div>
          </div>

          <div>
            <div class="box-header with-border">
              <h3 class="box-title">联系人</h3>
            </div>
            <div class="box-body table-responsive no-padding">
              <table class="table table-hover">
                <tbody>
                  <tr>
                    <th style="width: 10px">#</th>
                    <th>联系人</th>
                    <th>对接事务</th>
                    <th>手机</th>
                    <th>座机</th>
                    <th>职务</th>
                    <th>邮箱</th>
                    <th>微信</th>
                    <th>QQ</th>
                    <th>备注</th>
                  </tr>
                  <tr ng-repeat="item in customerInfo.contactList">
                    <td ng-bind="($index+1)+'.'"></td>
                    <td ng-bind="item.name"></td>
                    <td ng-bind="item.responsable"></td>
                    <td ng-bind="item.mobile"></td>
                    <td ng-bind="item.tel"></td>
                    <td ng-bind="item.position"></td>
                    <td ng-bind="item.email"></td>
                    <td ng-bind="item.wechat"></td>
                    <td ng-bind="item.QQ"></td>
                    <td ng-bind="item.memo"></td>
                  </tr>
                </tbody>
              </table>
              <div ng-if="!customerInfo.contactList.length" style="padding: 20px; font-size: 14px;">
                无联系人资料
              </div>
            </div>
          </div>
          <div>
            <div class="box-header with-border">
              <h3 class="box-title">在我司业务</h3>
            </div>
            <div class="box-body table-responsive no-padding">
              <table class="table table-hover">
                <tbody>
                  <tr>
                    <th style="width: 10px">#</th>
                    <th>订单类型</th>
                    <th>档案号</th>
                    <th>订单名称</th>
                    <th>英文名</th>
                    <th>订单状态</th>
                    <th>注册时间</th>
                    <!-- <th>录入时间</th> -->
                  </tr>
                  <tr ng-repeat="item in customerOrders">
                    <td ng-bind="($index+1)+'.'"></td>
                    <td ng-bind="item.order_type_name"></td>
                    <td ng-bind="item.order_code"></td>
                    <td ng-bind="item.order_name" ng-attr-title="{{item.order_name}}"></td>
                    <td ng-bind="item.order_name_en" ng-attr-title="{{item.order_name_en}}"></td>
                    <td ng-bind="getStatus(item)"></td>
                    <td ng-bind="format(item.date_setup, 'YYYY-MM-DD')"></td>
                    <!-- <td ng-bind="format(item.date_created, 'YYYY-MM-DD HH:MM')"></td> -->
                  </tr>
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="box box-danger">
      <div class="box-header with-border">
        <h3 class="box-title">附件</h3>
        <div class="box-tools">
          <div class="box-tools pull-right">
            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
            </button>
          </div>
        </div>
      </div>
      <div class="box-body table-responsive no-padding">
        <table class="table table-hover">
          <tbody>
            <tr>
              <th style="width: 10px">#</th>
              <th>名称</th>
              <th>附件</th>
              <th>上传时间</th>
              <th>备注</th>
              <th class="opt-col">操作</th>
            </tr>
            <tr ng-repeat="item in attachments">
              <td ng-bind="($index+1)+'.'"></td>
              <td ng-bind="item.name"></td>
              <td>
                <a href="{{item.attachment_url}}" target="_blank" ng-if="item.attachment_url.length">
                          点击查看
                      </a>
              </td>
              <td ng-bind="format(item.date_created, 'YYYY-MM-DD')"></td>
              <td ng-bind="item.description"></td>
              <td class="opt-col">
                <a href="javascript:;" class="fa fa-trash-o red" ng-click="deleteAttachment(item)" title="删除"></a>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="box-footer clearfix">
        <button type="button" class="btn btn-info" ui-sref=".attachment({source_name: 'annual_exam', source_id: data.id})" ui-sref-opts="{location:false}">新增</button>
      </div>
    </div>
  </form>
</section>
<div ui-view="modal"></div>
<div ui-view="progress"></div>
<div ui-view="print"></div>
<div ui-view="attachment"></div>
